package org.wzl.service.utils;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * @author: 卫志龙
 * @date: 2024年06月26日 15:15
 */
@Data
@AllArgsConstructor
public class Resp <T>{

    private T data;
    private String msg;
    private Integer code;

    public static <T> Resp<T> ok(T data) {
        return new Resp<T>(data, "ok", 200);
    }

    public static <T> Resp<T> ok(T data, String msg) {
        return new Resp<T>(data, msg, 200);
    }

    public static <T> Resp<T> fail(String msg) {
        return new Resp<T>(null, msg, 500);
    }

    public static <T> Resp<T> ok() {
        return new Resp<>(null , "ok", 200);
    }
}
